package com.qmyx.supply.admin.controller;

import com.ytjj.qmyx.supplychain.common.api.CommonResult;
import com.ytjj.qmyx.supplychain.mapper.entity.YxProductAttribute;
import com.ytjj.qmyx.supplychain.service.ProductAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 商品属性管理
 */
@RestController
@RequestMapping("/productAttribute")
public class ProductAttributeController {

    @Autowired
    private ProductAttributeService productAttributeService;

    /**
     * 根据类目获取属性
     */
    @GetMapping("/attributeByCategory")
    public CommonResult attributeByCategory(@RequestParam(value = "topCategoryId") Integer topCategoryId,
                                            @RequestParam(value = "categoryId", required = false) Integer categoryId,
                                            @RequestParam(value = "bottomCategoryId", required = false) Integer bottomCategoryId){
        return productAttributeService.attributeByCategory(topCategoryId, categoryId, bottomCategoryId);
    }
}
